package com.hanbang.gycatering.aboutme;

import com.hanbang.gangyu.R;
import com.hanbang.gycatering.homepage.BaseActivity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

public class AddBalance extends BaseActivity implements OnClickListener{
	private TextView balantab1,balantab2,balantab3,balantab4,balantab5,balantab6;
	private  TextView texts[]=new TextView[4];
	private EditText input_money;
     @Override
    protected void onCreate(Bundle savedInstanceState) {
    	// TODO Auto-generated method stub
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.addbalance);
    	initView();
    	initselect();
    	setListener();
    	
    }



	private void initView() {
		// TODO Auto-generated method stub
		setBackArrows((ImageView) findViewById(R.id.top_bar_left_image));
	    ((TextView) findViewById(R.id.top_bar_title)).setText("账户充值");
	    input_money=(EditText) findViewById(R.id.input_money);
	    balantab1=(TextView) findViewById(R.id.balantab1);
	    balantab2=(TextView) findViewById(R.id.balantab2);
	    balantab3=(TextView) findViewById(R.id.balantab3);
	    balantab4=(TextView) findViewById(R.id.balantab4);
	    balantab5=(TextView) findViewById(R.id.balantab5);
	    balantab6=(TextView) findViewById(R.id.balantab6);
	       texts[0]=balantab1;
	       texts[1]=balantab2;
	       texts[2]=balantab3;
	       texts[3]=balantab4;
	}


	private void setListener() {
		// TODO Auto-generated method stub
		balantab1.setOnClickListener(this);
		balantab2.setOnClickListener(this);
		balantab3.setOnClickListener(this);
		balantab4.setOnClickListener(this);
		balantab5.setOnClickListener(this);
		balantab6.setOnClickListener(this);
	}
	private void initselect() {
		// TODO Auto-generated method stub
		balantab1.setSelected(true);
		balantab2.setSelected(false);
		balantab3.setSelected(false);
		balantab4.setSelected(false);
		balantab5.setSelected(true);
		balantab6.setSelected(false);
	}


	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		switch (arg0.getId()) {
		case R.id.balantab1:
			setSelect(balantab1);
			input_money.setText("100");
			break;
		case R.id.balantab2:
			setSelect(balantab2);
			input_money.setText("300");
			break;
		case R.id.balantab3:
			setSelect(balantab3);
			input_money.setText("500");
			break;
		case R.id.balantab4:
			setSelect(balantab4);
			input_money.setText("1000");
			break;
		case R.id.balantab5:
			balantab5.setSelected(true);
			balantab6.setSelected(false);
			break;
		case R.id.balantab6:
			balantab6.setSelected(true);
			balantab5.setSelected(false);
			break;
		default:
			break;
		}
	}
	private void setSelect(TextView text) {
		// TODO Auto-generated method stub
		for (TextView text1 : texts) {
			if(text1.equals(text)){
				text1.setSelected(true);
			}else{
				text1.setSelected(false);
			}
		}
	}
}
